package com.xindz.cn.mvptest.app;

/**
 * @name Base
 * @class name：com.xindz.cn.base.app
 * @describe 系统中的环境配置相关
 * @anthor XINDZ
 * @time 2017/10/26 9:59
 * @change
 * @chang time
 * @class describe
 */
public class AppConfig {
    private volatile static AppConfig appConfig;

    /**
     * 开发状态 开发中设置为 DEVELOP_STATE_DEBUG ,发布设置为 DEVELOP_STATE_RELEASE
     */
    private boolean DEVELOP_STATE = AppConstant.DEVELOP_STATE_DEBUG;

    /**
     * LeanCloud 的APP_ID
     */
    private String LEANCLOUD_APP_ID;
    /**
     * LeanCloud 的APP_KEY
     */
    private String LEANCLOUD_APP_KEY;


    private AppConfig() {
    }

    public static AppConfig getAppConfig() {
        if (appConfig == null) {
            synchronized (AppConfig.class) {
                if (appConfig == null) {
                    appConfig = new AppConfig();
                }
            }
        }
        return appConfig;
    }

    public boolean getDevelopState() {
        return DEVELOP_STATE;
    }

    public String getLEANCLOUD_APP_ID() {
        if (DEVELOP_STATE) {
            LEANCLOUD_APP_ID = AppConstant.LeanCloud.LEANCLOUD_APP_ID_DEBUG;
        } else {
            LEANCLOUD_APP_ID = AppConstant.LeanCloud.LEANCLOUD_APP_ID_RELEASE;
        }
        return LEANCLOUD_APP_ID;
    }

    public String getLEANCLOUD_APP_KEY() {
        if (DEVELOP_STATE) {
            LEANCLOUD_APP_KEY = AppConstant.LeanCloud.LEANCLOUD_APP_KEY_RELEASE;
        } else {
            LEANCLOUD_APP_KEY = AppConstant.LeanCloud.LEANCLOUD_APP_KEY_RELEASE;
        }
        return LEANCLOUD_APP_KEY;
    }
}
